		******************************************
		*   Aditional Product Fields by PeterB   *
		*                 v 1.0                  *
		*                                        *
		*          www.openhosting.sk            *
		*                                        *
		*            www.zencart.cz              *
		*                                        *
		*           18.07.2007 00:11             *
		*					 *
		*       peter.bohus@openhosting.sk       *
		*                                        *
		******************************************


This contribution give you possibility to add 5 aditional fields for each product.

To set-up aditional fields is very easy:
On "Product In Category" page on bottom you can see it 3 columns
- In first you may activated fields by radio button
- In second is name of parameter
- In third is value of your parameter

You can Set-Up how many of fields you can show on page, is up to you.
____________________________________________________________________________________
Installation:

Installation is not so complicated, but if you had modified files, may you need
modified files with code below.

If you have fresh installation, you need just copy files, or if you are shore,
that you have no problem replace files, do it!

DO NOT FORGOT BACK-UP YOUR FILES!!!

files to replace:

includes/templates/...YOUR TEMPLATE.../templates/tpl_product_info_display.php
includes/modules/pages/product_info/main_template_vars.php
admin/includes/modules/update_product.php
admin/includes/modules/product/collect_info.php
admin/includes/modules/product/preview_info.php
admin/includes/languages/english/product.php

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
SQL:
************************************************************
*BACKUP YOUR DATABASE!!! (minimum is, backup table product)*
************************************************************

add SQL patch by admin "install SQL patches"

or use Aditional_fields_SQL_patch.sql (but you need to take care about database prefix)


SQL patch:

# field 1
ALTER TABLE `products` ADD `field_1_act` VARCHAR( 2 ) BINARY ;
ALTER TABLE `products` ADD `field_1_name` VARCHAR( 32 ) ;
ALTER TABLE `products` ADD `field_1_value` VARCHAR( 64 ) ;

#field 2
ALTER TABLE `products` ADD `field_2_act` VARCHAR( 2 ) BINARY ;
ALTER TABLE `products` ADD `field_2_name` VARCHAR( 32 ) ;
ALTER TABLE `products` ADD `field_2_value` VARCHAR( 64 ) ;

#field 3
ALTER TABLE `products` ADD `field_3_act` VARCHAR( 2 ) BINARY ;
ALTER TABLE `products` ADD `field_3_name` VARCHAR( 32 ) ;
ALTER TABLE `products` ADD `field_3_value` VARCHAR( 64 ) ;

#field 4
ALTER TABLE `products` ADD `field_4_act` VARCHAR( 2 ) BINARY ;
ALTER TABLE `products` ADD `field_4_name` VARCHAR( 32 ) ;
ALTER TABLE `products` ADD `field_4_value` VARCHAR( 64 ) ;

#field 5
ALTER TABLE `products` ADD `field_5_act` VARCHAR( 2 ) BINARY ;
ALTER TABLE `products` ADD `field_5_name` VARCHAR( 32 ) ;
ALTER TABLE `products` ADD `field_5_value` VARCHAR( 64 ) ;
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

PHP:
copy files includet in package in case of folders

If you had  modified your files, follow instructions below:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
backup and open file> includes/templates/...YOUR TEMPLATE.../templates/tpl_product_info_display.php

find:
<!--bof Product details list  -->
<?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name) or ($field_1_act == 1 and $field_1_value !=0))) ) { ?>
<ul id="productDetailsList" class="floatingBox back">
  <?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li>' . TEXT_PRODUCT_WEIGHT .  $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>'  : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>'  : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?>

after add:
  <?php //bof aditional fields by PeterB ?>
  <?php echo (($field_1_act == 1 and !empty($field_1_value)) ? '<li>' . $field_1_name . '&nbsp;' . $field_1_value . '</li>' : '') . "\n"; ?>
  <?php echo (($field_2_act == 1 and !empty($field_2_value)) ? '<li>' . $field_2_name . '&nbsp;' . $field_2_value . '</li>' : '') . "\n"; ?>
  <?php echo (($field_3_act == 1 and !empty($field_3_value)) ? '<li>' . $field_3_name . '&nbsp;' . $field_3_value . '</li>' : '') . "\n"; ?>
  <?php echo (($field_4_act == 1 and !empty($field_4_value)) ? '<li>' . $field_4_name . '&nbsp;' . $field_4_value . '</li>' : '') . "\n"; ?>
  <?php echo (($field_5_act == 1 and !empty($field_5_value)) ? '<li>' . $field_5_name . '&nbsp;' . $field_5_value . '</li>' : '') . "\n"; ?>
  <?php //eof aditional fields by PeterB ?>

save and close file
_ _ _ _  _ _ _ _  _ _ _ _ _ _ 
backup and open file> includes/modules/pages/product_info/main_template_vars.php

find:
$sql = "select p.products_id, pd.products_name,
                  pd.products_description, p.products_model,
                  p.products_quantity, p.products_image,
                  pd.products_url, p.products_price,
                  p.products_tax_class_id, p.products_date_added,
                  p.products_date_available, p.manufacturers_id, p.products_quantity,
                  p.products_weight, p.products_priced_by_attribute, p.product_is_free,
                  p.products_qty_box_status,
                  p.products_quantity_order_max,
                  p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter

replace with:
$sql = "select p.products_id, pd.products_name,
                  pd.products_description, p.products_model,
                  p.products_quantity, p.products_image,
                  pd.products_url, p.products_price,
                  p.products_tax_class_id, p.products_date_added,
                  p.products_date_available, p.manufacturers_id, p.products_quantity,
                  p.products_weight, p.products_priced_by_attribute, p.product_is_free,
                  p.products_qty_box_status,
                  p.products_quantity_order_max,
                  p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter,
                  p.field_1_act, p.field_1_name, p.field_1_value, p.field_2_act, p.field_2_name,p.field_2_value,
                  p.field_3_act, p.field_3_name, p.field_3_value, p.field_4_act, p.field_4_name, p.field_4_value,
                  p.field_5_act, p.field_5_name, p.field_5_value

find:
 require(DIR_WS_MODULES . zen_get_module_directory('product_prev_next.php'));

  $products_name = $product_info->fields['products_name'];
  $products_model = $product_info->fields['products_model'];

after add:
  // bof aditional fields by PeterB
  $field_1_act = $product_info->fields['field_1_act'];
  $field_1_name = $product_info->fields['field_1_name'];
  $field_1_value = $product_info->fields['field_1_value'];
  $field_2_act = $product_info->fields['field_2_act'];
  $field_2_name = $product_info->fields['field_2_name'];
  $field_2_value = $product_info->fields['field_2_value'];
  $field_3_act = $product_info->fields['field_3_act'];
  $field_3_name = $product_info->fields['field_3_name'];
  $field_3_value = $product_info->fields['field_3_value'];
  $field_4_act = $product_info->fields['field_4_act'];
  $field_4_name = $product_info->fields['field_4_name'];
  $field_4_value = $product_info->fields['field_4_value'];
  $field_5_act = $product_info->fields['field_5_act'];
  $field_5_name = $product_info->fields['field_5_name'];
  $field_5_value = $product_info->fields['field_5_value'];
  // eof aditional fields by PeterB

save and close file
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
backup and open file> admin/includes/modules/update_product.php

find:
    $sql_data_array = array('products_quantity' => $products_quantity,
                            'products_type' => zen_db_prepare_input($_GET['product_type']),
                            'products_model' => zen_db_prepare_input($_POST['products_model']),
                            'products_price' => $products_price,
                            'products_date_available' => $products_date_available,
                            'products_weight' => $products_weight,

after add:
			    'field_1_act' => zen_db_prepare_input($_POST['field_1_act']),
                            'field_1_name' => zen_db_prepare_input($_POST['field_1_name']),
                            'field_1_value' => zen_db_prepare_input($_POST['field_1_value']),
                            'field_2_act' => zen_db_prepare_input($_POST['field_2_act']),
                            'field_2_name' => zen_db_prepare_input($_POST['field_2_name']),
                            'field_2_value' => zen_db_prepare_input($_POST['field_2_value']),
                            'field_3_act' => zen_db_prepare_input($_POST['field_3_act']),
                            'field_3_name' => zen_db_prepare_input($_POST['field_3_name']),
                            'field_3_value' => zen_db_prepare_input($_POST['field_3_value']),
                            'field_4_act' => zen_db_prepare_input($_POST['field_4_act']),
                            'field_4_name' => zen_db_prepare_input($_POST['field_4_name']),
                            'field_4_value' => zen_db_prepare_input($_POST['field_4_value']),
                            'field_5_act' => zen_db_prepare_input($_POST['field_5_act']),
                            'field_5_name' => zen_db_prepare_input($_POST['field_5_name']),
                            'field_5_value' => zen_db_prepare_input($_POST['field_5_value']),
save and close file
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
backup and open file> admin/includes/modules/product/collect_info.php

find:
    if (isset($_GET['pID']) && empty($_POST)) {
      $product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,
                                      p.products_id, p.products_quantity, p.products_model,
                                      p.products_image, p.products_price, p.products_virtual, p.products_weight,
                                      p.products_date_added, p.products_last_modified,
                                      date_format(p.products_date_available, '%Y-%m-%d') as
                                      products_date_available, p.products_status, p.products_tax_class_id,
                                      p.manufacturers_id,
                                      p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed,
                                      p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
                                      p.products_sort_order,
                                      p.products_discount_type, p.products_discount_type_from,
                                      p.products_price_sorter, p.master_categories_id

replace with:
    if (isset($_GET['pID']) && empty($_POST)) {
      $product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,
                                      p.products_id, p.products_quantity, p.products_model,
                                      p.products_image, p.products_price, p.products_virtual, p.products_weight,
                                      p.products_date_added, p.products_last_modified,
                                      date_format(p.products_date_available, '%Y-%m-%d') as
                                      products_date_available, p.products_status, p.products_tax_class_id,
                                      p.manufacturers_id,
                                      p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed,
                                      p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
                                      p.products_sort_order,
                                      p.products_discount_type, p.products_discount_type_from,
                                      p.products_price_sorter, p.master_categories_id,
                                      p.field_1_act, p.field_1_name, p.field_1_value,
                                      p.field_2_act, p.field_2_name, p.field_2_value,
                                      p.field_3_act, p.field_3_name, p.field_3_value,
                                      p.field_4_act, p.field_4_name, p.field_4_value,
                                      p.field_5_act, p.field_5_name, p.field_5_value

find:
// Products can be purchased with mixed attributes retail
    if (!isset($pInfo->products_quantity_mixed)) $pInfo->products_quantity_mixed = '0';
    switch ($pInfo->products_quantity_mixed) {
      case '0': $in_products_quantity_mixed = false; $out_products_quantity_mixed = true; break;
      case '1': $in_products_quantity_mixed = true; $out_products_quantity_mixed = false; break;
      default: $in_products_quantity_mixed = true; $out_products_quantity_mixed = false;
    }

after add:
// bof aditional fields by PeterB
// Set field 1 act
    if (!isset($pInfo->field_1_act)) $pInfo->field_1_act = '0';
    switch ($pInfo->field_1_act) {
      case '0': $in_field_1_act = false; $no_field_1_act = true; break;
      case '1': $in_field_1_act = true; $no_field_1_act = false; break;
      default: $in_field_1_act = true; $no_field_1_act = false;
    }
// Set field 2 act
    if (!isset($pInfo->field_2_act)) $pInfo->field_2_act = '0';
    switch ($pInfo->field_2_act) {
      case '0': $in_field_2_act = false; $no_field_2_act = true; break;
      case '1': $in_field_2_act = true; $no_field_2_act = false; break;
      default: $in_field_2_act = true; $no_field_2_act = false;
    }
// Set field 3 act
    if (!isset($pInfo->field_3_act)) $pInfo->field_3_act = '0';
    switch ($pInfo->field_3_act) {
      case '0': $in_field_3_act = false; $no_field_3_act = true; break;
      case '1': $in_field_3_act = true; $no_field_3_act = false; break;
      default: $in_field_3_act = true; $no_field_3_act = false;
    }
// Set field 4 act
    if (!isset($pInfo->field_4_act)) $pInfo->field_4_act = '0';
    switch ($pInfo->field_4_act) {
      case '0': $in_field_4_act = false; $no_field_4_act = true; break;
      case '1': $in_field_4_act = true; $no_field_4_act = false; break;
      default: $in_field_4_act = true; $no_field_4_act = false;
    }
// Set field 5 act
    if (!isset($pInfo->field_5_act)) $pInfo->field_5_act = '0';
    switch ($pInfo->field_5_act) {
      case '0': $in_field_5_act = false; $no_field_5_act = true; break;
      case '1': $in_field_5_act = true; $no_field_5_act = false; break;
      default: $in_field_5_act = true; $no_field_5_act = false;
    }
// eof aditional fields by PeterB

find (on end):
      <tr>
        <td class="main" align="right"><?php echo zen_draw_hidden_field('products_date_added', (zen_not_null($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d'))) . zen_image_submit('button_preview.gif', IMAGE_PREVIEW) . '&nbsp;&nbsp;<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
      </tr>
      </table>
    </form>

before add:

     <tr>
      <td>
      <?php // bof aditional fields by PeterB ?>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
            <td colspan="3"><?php echo zen_draw_separator('pixel_black.gif', '100%', '3'); ?></td>
      </tr>
      <tr>
            <td colspan="3"><BR /></td>
      </tr>
      <tr>
        <td colspan=2><?php echo '<h3>' . TEXT_ADITIONAL_FIELDS . '<h3>'; ?></td>
      </tr>
      <tr>                                                                                                                              
        <td class="main"><?php echo '<h4>' . TEXT_ACTIVATE_FIELD . '<h4>'; ?></td>
        <td class="main"><?php echo '<h4>' . TEXT_NAME_FIELD . '<h4>'; ?></td>
        <td class="main"><?php echo '<h4>' . TEXT_VALUE_FIELD . '<h4>'; ?></td>
      </tr>
      <tr>                                                                                                                              
        <td class="main"><?php echo zen_draw_radio_field('field_1_act', '1', ($in_field_1_act==1)) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('field_1_act', '0', ($in_field_1_act==0)) . '&nbsp;' . TEXT_NO ; ?></td>
        <td class="main"><?php echo zen_draw_input_field('field_1_name', $pInfo->field_1_name, zen_set_field_length(TABLE_PRODUCTS, 'field_1_name')); ?></td>
        <td class="main"><?php echo zen_draw_input_field('field_1_value', $pInfo->field_1_value, zen_set_field_length(TABLE_PRODUCTS, 'field_1_value')); ?></td>
      </tr>
      <tr>                                                                                                                              
        <td class="main"><?php echo zen_draw_radio_field('field_2_act', '1', ($in_field_2_act==1)) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('field_2_act', '0', ($in_field_2_act==0)) . '&nbsp;' . TEXT_NO ; ?></td>
        <td class="main"><?php echo zen_draw_input_field('field_2_name', $pInfo->field_2_name, zen_set_field_length(TABLE_PRODUCTS, 'field_2_name')); ?></td>
        <td class="main"><?php echo zen_draw_input_field('field_2_value', $pInfo->field_2_value, zen_set_field_length(TABLE_PRODUCTS, 'field_2_value')); ?></td>
      </tr>
      <tr>                                                                                                                              
        <td class="main"><?php echo zen_draw_radio_field('field_3_act', '1', ($in_field_3_act==1)) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('field_3_act', '0', ($in_field_3_act==0)) . '&nbsp;' . TEXT_NO ; ?></td>
        <td class="main"><?php echo zen_draw_input_field('field_3_name', $pInfo->field_3_name, zen_set_field_length(TABLE_PRODUCTS, 'field_3_name')); ?></td>
        <td class="main"><?php echo zen_draw_input_field('field_3_value', $pInfo->field_3_value, zen_set_field_length(TABLE_PRODUCTS, 'field_3_value')); ?></td>
      </tr>
      <tr>                                                                                                                              
        <td class="main"><?php echo zen_draw_radio_field('field_4_act', '1', ($in_field_4_act==1)) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('field_4_act', '0', ($in_field_4_act==0)) . '&nbsp;' . TEXT_NO ; ?></td>
        <td class="main"><?php echo zen_draw_input_field('field_4_name', $pInfo->field_4_name, zen_set_field_length(TABLE_PRODUCTS, 'field_4_name')); ?></td>
        <td class="main"><?php echo zen_draw_input_field('field_4_value', $pInfo->field_4_value, zen_set_field_length(TABLE_PRODUCTS, 'field_4_value')); ?></td>
      </tr>
      <tr>                                                                                                                              
        <td class="main"><?php echo zen_draw_radio_field('field_5_act', '1', ($in_field_5_act==1)) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('field_5_act', '0', ($in_field_5_act==0)) . '&nbsp;' . TEXT_NO ; ?></td>
        <td class="main"><?php echo zen_draw_input_field('field_5_name', $pInfo->field_5_name, zen_set_field_length(TABLE_PRODUCTS, 'field_5_name')); ?></td>
        <td class="main"><?php echo zen_draw_input_field('field_5_value', $pInfo->field_5_value, zen_set_field_length(TABLE_PRODUCTS, 'field_5_value')); ?></td>
      </tr>
      <tr>
            <td colspan="3"><BR /></td>
      </tr>
      <tr>
            <td colspan="3"><?php echo zen_draw_separator('pixel_black.gif', '100%', '3'); ?></td>
      </tr>
    </table>
    <?php // eof aditional fields by PeterB ?>
    </td>
    </tr>

save and close file
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
backup and open file> admin/includes/modules/product/preview_info.php

find:
      $product = $db->Execute("select p.products_id, pd.language_id, pd.products_name,
                                      pd.products_description, pd.products_url, p.products_quantity,
                                      p.products_model, p.products_image, p.products_price, p.products_virtual,
                                      p.products_weight, p.products_date_added, p.products_last_modified,
                                      p.products_date_available, p.products_status, p.manufacturers_id,
                                      p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed,
                                      p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
                                      p.products_sort_order

replace with:
      $product = $db->Execute("select p.products_id, pd.language_id, pd.products_name,
                                      pd.products_description, pd.products_url, p.products_quantity,
                                      p.products_model, p.products_image, p.products_price, p.products_virtual,
                                      p.products_weight, p.products_date_added, p.products_last_modified,
                                      p.products_date_available, p.products_status, p.manufacturers_id,
                                      p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed,
                                      p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
                                      p.products_sort_order, p.field_1_act, p.field_1_name, p.field_1_value,
                                      p.field_2_act, p.field_2_name, p.field_2_value, p.field_3_act, p.field_3_name, p.field_3_value,
                                      p.field_4_act, p.field_4_name, p.field_4_value, p.field_5_act, p.field_5_name, p.field_5_value

save and close file
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
backup and open file> admin/includes/languages/english/product.php

on end add:

// aditional prices by PeterB
  define('TEXT_ADITIONAL_FIELDS', 'Aditional Fields:');
  define('TEXT_ACTIVATE_FIELD', 'Activation');
  define('TEXT_NAME_FIELD', 'Name');
  define('TEXT_VALUE_FIELD', 'Value');
  

save and close file
_ _ _ _  _ _ _ _  _ _ _ _ _ _ 

thats all folks - ENJOY!!!